package com.ai.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ai.web.service.TrainService;
import com.ai.web.vo.ResultModel;
import com.ai.web.vo.TrainV;
import com.tiny.persistence.domain.Train;
import com.tiny.persistence.repository.TrainRepo;

@Service
public class TrainServiceImpl extends BaseServiceImpl<Train, Integer, TrainV> implements TrainService  {

    @Autowired
    private TrainRepo trainRepo;
    
    @Autowired
    public TrainServiceImpl(TrainRepo trainRepo) {
        super(trainRepo);
    }

    public TrainV getTrain(int userId) throws Exception {
        return getT(userId);
    }

    public ResultModel saveTrain(TrainV trainV) throws Exception {
        
        TrainV saveV = saveT(trainV);
        
        ResultModel rm = new ResultModel();
        rm.setData(saveV);
        rm.setSuccessCode();
        
        return rm;
    }

    public ResultModel deleteTrains(List<Integer> userIds) throws Exception {
        deleteTs(userIds);
        
        ResultModel rm = new ResultModel();
        rm.setSuccessCode();
        rm.setMsg("删除成功！");
        
        return rm;
    }

}
